package cn.tedu.totalscore;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class TotalScoreMapper
		extends Mapper<LongWritable,Text,Text,IntWritable>{
	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, IntWritable>.Context context)
			throws IOException, InterruptedException {
		//"Bob 90"  通过split--> strs[0] = "Bob" strs[1] = "90"
		String[] strs = value.toString().split(" ");
//		for (String string : strs) {
//			
//		}
		context.write(new Text(strs[0]),
				new IntWritable(Integer.parseInt(strs[1])));
	}
}
